package com.mycompany.myapp.web.rest.electricbicyclecontroller;

import com.codahale.metrics.annotation.Timed;
import com.mycompany.myapp.qrcode.ElecBicycleIDQRcode;
import com.mycompany.myapp.repository.ElectricBicycleRepository;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Create by wys on 2018/7/25
 */
@RestController
@RequestMapping("/api")
@Api(tags = "电动车生成二维码相关API")
public class ElecBicycleQRnodeController {

    @Autowired
    ElectricBicycleRepository electricBicycleRepository;

    @GetMapping("/getelecBicycleIDQRcode")
    @ApiOperation(value = "获得电动车的序号二维码")
    @Timed
    public ResponseEntity<String> getelecBicycleIDQRcode() {

        ElecBicycleIDQRcode elecBicycleIDQRcode = new ElecBicycleIDQRcode();

        String result = elecBicycleIDQRcode.getelecBicycleIDQRcode(electricBicycleRepository
        .findAll());

        return ResponseEntity.ok()
            .body(result);
    }

}
